#ifndef DASHBOARD_WIDGET2_H
#define DASHBOARD_WIDGET2_H

#include <QWidget>

struct DashBoardWidget2Private;

//大小闸仪表
class DashBoardWidget2 : public QWidget
{
    Q_OBJECT
    Q_PROPERTY(int rotation READ rotation WRITE setRotation) //旋转
    Q_PROPERTY(double min READ min WRITE setMin)
    Q_PROPERTY(double max READ max WRITE setmax)

public:
    explicit DashBoardWidget2(QWidget *parent = nullptr);
    ~DashBoardWidget2();

public:
    int rotation() const;
    void setRotation(const int value);

    void setMin(const double min);
    double min() const;

    void setmax(const double max);
    double max() const;

    //设置仪表图片
    void setMeterImagePath(QString imagePath);
private:
    //智能指针
    QScopedPointer<DashBoardWidget2Private> d;

    //仪表图片路径
    QString m_meterImagePath;

    //设置闸位状态（上调、下压）
    bool m_gatePressDownStatus = false;
protected:
    void paintEvent(QPaintEvent *event) override;

private:
    /**
     * @brief drawPole:画手柄
     * @param painter
     */
    void drawPole(QPainter *painter);

signals:
    void valueChanged(const int value);

    void gatePressDownStatusChanged(bool);
private slots:
    void onStartAnimation(const int value);
};

#endif // DASHBOARD_WIDGET2_H
